import time
import uiautomation as auto
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys

chrome_driver=webdriver.Chrome()
chrome_driver.maximize_window()

chrome_driver.get('https://www.4399.com/')


def login_with_single_id():
    WebDriverWait(chrome_driver, 5).until(EC.element_to_be_clickable((By.ID, "login_tologin")))


login_control = chrome_driver.find_element(By.ID, "login_tologin")
login_control.click()
chrome_driver.add_argument('--headless')
chrome_driver.add_argument('blink-settings=imagesEnabled=false')
chrome_driver.switch_to.frame('popup_login_frame')
id_control=chrome_driver.find_element(By.ID,'username')
id_control.send_keys('3178071914')
pwd_control=chrome_driver.find_element(By.ID,'j-password')
pwd_control.send_keys('zzh20040608')
denglu=chrome_driver.find_element(By.XPATH,'//*[@id="login_form"]/fieldset/div[5]/input')
denglu.click()
time.sleep(3)
